package com.javacoo.fastdfs.client.api.template;

import com.javacoo.fastdfs.client.config.FastDFSConfig;
import com.javacoo.fastdfs.client.exception.JccfcFastDFSException;

import java.util.Optional;

/**
 * FastDFS操作模板接口
 * <p>说明:</p>
 * <li></li>
 *
 * @author duanyong@jccfc.com
 * @date 2020/5/3 15:22
 */
public interface FastDFSTemplate {
    /**
     * 初始化
     * <p>说明:</p>
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2020/5/3 15:48
     * @param fastDFSConfig FastDFS配置类
     * @return FastDFSTemplate
     */
    FastDFSTemplate init(FastDFSConfig fastDFSConfig) throws Exception;
    /**
     * 运行方法
     * <p>说明:</p>
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2020/5/3 15:23
     * @param executor 执行器
     * @return Optional<R>
     */
    <R> Optional<R> run(Executor<R> executor) throws JccfcFastDFSException;
    /**
     * 获取FastDFS配置类
     * <p>说明:</p>
     * <li></li>
     * @author duanyong@jccfc.com
     * @date 2020/5/3 15:51
     */
    FastDFSConfig getFastDFSConfig();
}
